/*      */
package handling;
/*      */
/*      */

import client.MapleClient;
/*      */ import client.MapleEnumClass;
/*      */ import configs.MTSConfig;
/*      */ import configs.ServerConfig;
/*      */ import constants.ServerConstants;
/*      */ import handling.cashshop.CashShopServer;
/*      */ import handling.cashshop.handler.BuyCashItemHandler;
/*      */ import handling.cashshop.handler.CashShopOperation;
/*      */ import handling.cashshop.handler.CouponCodeHandler;
/*      */ import handling.cashshop.handler.MTSOperation;
/*      */ import handling.channel.ChannelServer;
/*      */ import handling.channel.handler.BBSHandler;
/*      */ import handling.channel.handler.BuddyListHandler;
/*      */ import handling.channel.handler.ChatHandler;
/*      */ import handling.channel.handler.DueyHandler;
/*      */ import handling.channel.handler.GuildHandler;
/*      */ import handling.channel.handler.HiredFisherHandler;
/*      */ import handling.channel.handler.HiredMerchantHandler;
/*      */ import handling.channel.handler.InterServerHandler;
/*      */ import handling.channel.handler.InventoryHandler;
/*      */ import handling.channel.handler.ItemMakerHandler;
/*      */ import handling.channel.handler.ItemScrollHandler;
/*      */ import handling.channel.handler.MobHandler;
/*      */ import handling.channel.handler.NPCHandler;
/*      */ import handling.channel.handler.PartyHandler;
/*      */ import handling.channel.handler.PetHandler;
/*      */ import handling.channel.handler.PhantomMemorySkill;
/*      */ import handling.channel.handler.PlayerHandler;
/*      */ import handling.channel.handler.PlayerInteractionHandler;
/*      */ import handling.channel.handler.PlayersHandler;
/*      */ import handling.channel.handler.PotionPotHandler;
/*      */ import handling.channel.handler.StatsHandling;
/*      */ import handling.channel.handler.SummonHandler;
/*      */ import handling.channel.handler.SystemProcess;
/*      */ import handling.channel.handler.TakeDamageHandler;
/*      */ import handling.channel.handler.UseCashItemHandler;
/*      */ import handling.channel.handler.UseHammerHandler;
/*      */ import handling.chat.ChatServer;
/*      */ import handling.login.LoginServer;
/*      */ import handling.login.handler.CharSelectedHandler;
/*      */ import handling.login.handler.CharlistRequestHandler;
/*      */ import handling.login.handler.CheckCharNameHandler;
/*      */ import handling.login.handler.ClientErrorLogHandler;
/*      */ import handling.login.handler.CreateCharHandler;
/*      */ import handling.login.handler.CreateUltimateHandler;
/*      */ import handling.login.handler.DeleteCharHandler;
/*      */ import handling.login.handler.LicenseRequestHandler;
/*      */ import handling.login.handler.LoginPasswordHandler;
/*      */ import handling.login.handler.MapLoginHandler;
/*      */ import handling.login.handler.PacketErrorHandler;
/*      */ import handling.login.handler.PartJobHandler;
/*      */ import handling.login.handler.ServerStatusRequestHandler;
/*      */ import handling.login.handler.ServerlistRequestHandler;
/*      */ import handling.login.handler.SetGenderHandler;
/*      */ import handling.login.handler.ShowAccCash;
/*      */ import handling.login.handler.ShowCharCards;
/*      */ import handling.login.handler.UpdateCharCards;
/*      */ import handling.login.handler.UpdatePlayerSlots;
/*      */ import handling.netty.MaplePacketDecoder;
/*      */ import handling.opcode.CashShopOpcode;
/*      */ import handling.opcode.RecvPacketOpcode;
/*      */ import handling.opcode.SendPacketOpcode;
/*      */ import io.netty.channel.ChannelHandlerContext;
/*      */ import io.netty.channel.ChannelInboundHandlerAdapter;
/*      */ import java.io.File;
/*      */ import java.io.FileWriter;
/*      */ import java.util.ArrayList;
/*      */ import java.util.List;
/*      */ import java.util.Map;
/*      */ import java.util.concurrent.ConcurrentHashMap;
/*      */ import org.apache.logging.log4j.LogManager;
/*      */ import org.apache.logging.log4j.Logger;
/*      */ import tools.HexTool;
/*      */ import tools.MapleAESOFB;
/*      */ import tools.MaplePacketCreator;
/*      */ import tools.Pair;
/*      */ import tools.Randomizer;
/*      */ import tools.data.input.ByteArrayByteStream;
/*      */ import tools.data.input.GenericSeekableLittleEndianAccessor;
/*      */ import tools.data.input.SeekableInputStreamBytestream;
/*      */ import tools.data.input.SeekableLittleEndianAccessor;
/*      */ import tools.packet.LoginPacket;

/*      */
/*      */ public class MapleServerHandler extends ChannelInboundHandlerAdapter {
    /*   40 */   public static final List<String> BlockIPList = new ArrayList<>();
    /*      */
    /*   41 */   public static final Logger AllPacketLog = LogManager.getLogger("AllPackets");
    /*      */
    /*   42 */   public static final Logger BuffPacketLog = LogManager.getLogger("BuffPackets");
    /*      */
    /*   43 */   public static final Logger AttackPakcetLog = LogManager.getLogger("AttackPackets");
    /*      */
    /*      */   public static final boolean preventIpAttack = true;
    /*      */
    /*   45 */   private static final Logger log = LogManager.getLogger(MapleServerHandler.class.getName());
    /*      */
    /*      */   private static boolean show = false;
    /*      */
    /*   47 */   private final Map<String, Pair<Long, Byte>> tracker = new ConcurrentHashMap<>();
    /*      */
    /*   48 */   private int world = -1;
    /*      */
    /*   48 */   private int channel = -1;
    /*      */
    /*   49 */   private ServerType type = null;

    /*      */
    /*      */
    public MapleServerHandler(int world, int channel, ServerType type) {
        /*   52 */
        this.world = world;
        /*   53 */
        this.channel = channel;
        /*   54 */
        this.type = type;
        /*      */
    }

    /*      */
    /*      */
    public static void handlePacket(RecvPacketOpcode header, SeekableLittleEndianAccessor slea, MapleClient c, ServerType type) throws Exception {
        /*      */
        int clientfile;
        /*      */
        int checkfile;
        /*      */
        int playerid;
        /*      */
        byte by2;
        /*   58 */
        switch (header) {
            /*      */
            case PONG:
                /*      */
                break;
            case PONG2:
                /*   61 */
                c.pongReceived();
                /*      */
                break;
            case CHAT_SERVER_PONG:
                /*   64 */
                c.chatServerPongReceived();
                /*      */
                break;
            case STRANGE_DATA:
                /*      */
                
            /*      */
            break;
            case CLIENT_AUTH:
                /*   70 */
                slea.skip(1);
                /*   71 */
                clientfile = slea.readInt();
                /*   73 */
                checkfile = (clientfile >> 5 << 5) + (((clientfile & 0x1F) >> 3 ^ 0x2) << 3) + 7 - (clientfile & 0x7) | clientfile >> 7 << 7;
                /*   74 */
                --checkfile;
                /*      */
                break;
            case CLIENT_ERROR:
                /*   79 */
                ClientErrorLogHandler.handlePacket( slea, c);
                /*      */
                break;
            case CLIENT_FAIL:
                /*   82 */
                PacketErrorHandler.handlePacket( slea, c);
                /*      */
                break;
            case REQUEST_CONNECTION:
                /*   85 */
                c.announce(LoginPacket.addConnection());
                /*      */
                break;
            case CHAT_SERVER_REQUEST:
                /*   88 */
                ChatHandler.EnterChatServer( slea, c);
                /*      */
                break;
            case GUILD_CHAT:
                /*   91 */
                ChatHandler.GuildChat( slea, c);
                /*      */
                break;
            case BUDDY_CHAT:
                /*   94 */
                ChatHandler.BuddyChat( slea, c);
                /*      */
                break;
            case LOGIN_PASSWORD:
                /*   97 */
                LoginPasswordHandler.handlePacket( slea, c);
                /*      */
                break;
            case LICENSE_REQUEST:
                /*  100 */
                LicenseRequestHandler.handlePacket( slea, c);
                /*      */
                break;
            case SET_GENDER:
                /*  103 */
                SetGenderHandler.handlePacket( slea, c);
                /*      */
                break;
            case CHARACTER_CARDS:
                /*  106 */
                UpdateCharCards.handlePacket( slea, c);
                /*      */
                break;
            case SET_CHAR_CARDS:
                /*  109 */
                ShowCharCards.handlePacket( slea, c);
                /*      */
                break;
            case SET_ACC_CASH:
                /*  112 */
                ShowAccCash.handlePacket( slea, c);
                /*      */
                break;
            case SERVERLIST_REQUEST:
                /*  132 */
                ServerlistRequestHandler.handlePacket(c, true);
                /*      */
                break;
            case CLIENT_HELLO:
                /*  135 */
                MapLoginHandler.handlePacket( slea, c, type);
                /*      */
                break;
            case CP_WorldIdRequest:
                /*  139 */
                c.announce(LoginPacket.getWorldId(ServerConfig.LOGIN_SERVERFLAG));
                /*      */
                break;
            case CHARLIST_REQUEST:
                /*  142 */
                CharlistRequestHandler.handlePacket( slea, c);
                /*      */
                break;
            case SERVERSTATUS_REQUEST:
                /*  145 */
                ServerStatusRequestHandler.handlePacket(c);
                /*      */
                break;
            case CHECK_CHAR_NAME:
                /*  148 */
                CheckCharNameHandler.handlePacket( slea, c);
                /*      */
                break;
            case CREATE_CHAR:
                /*  151 */
                CreateCharHandler.handlePacket( slea, c);
                /*      */
                break;
            case CREATE_ULTIMATE:
                /*  154 */
                CreateUltimateHandler.handlePacket( slea, c);
                /*      */
                break;
            case DELETE_CHAR:
                /*  157 */
                DeleteCharHandler.handlePacket( slea, c);
                /*      */
                break;
            case PART_TIME_JOB:
                /*  160 */
                PartJobHandler.handlePacket( slea, c);
                /*      */
                break;
            case CHAR_SELECT:
            case CHAR_SELECTED:
                /*  164 */
                CharSelectedHandler.handlePacket( slea, c);
                /*      */
                break;
            case UPDATE_CHARSLOT:
                /*  167 */
                UpdatePlayerSlots.handlePacket( slea);
                /*      */
                break;
            case RSA_KEY:
                /*  170 */
                c.announce(LoginPacket.getLoginAUTH());
                /*  171 */
                if (ServerConfig.WORLD_ONLYADMIN)
                    /*  172 */ for (int i = 1; i <= 2; i++) {
                    /*  173 */
                    MapleEnumClass.AuthReply login = c.login("admin" + i, "admin", false, false);
                    /*  174 */
                    if (login == MapleEnumClass.AuthReply.GAME_LOGIN_SUCCESSFUL) {
                        /*  175 */
                        c.setTempInfo("admin" + i, "admin", false);
                        /*  176 */
                        LoginPasswordHandler.Login(c);
                        /*      */
                        break;
                        /*      */
                    }
                    /*      */
                }
                /*      */
                break;
            case CREATE_CHAR_REQUEST:
                /*  183 */
                CreateCharHandler.getCreatCharAuth( slea, c);
                /*      */
                break;
            case SEAL_FAMILIAR:
                /*  191 */
                PlayerHandler.sealFamiliar( slea, c, c.getPlayer());
                /*      */
                break;
            case CHANGE_CHANNEL:
                /*  194 */
                InterServerHandler.ChangeChannel( slea, c, c.getPlayer());
                /*      */
                break;
            case PLAYER_LOGGEDIN:
                /*  197 */
                slea.readInt();
                /*  198 */
                playerid = slea.readInt();
                /*  200 */
                InterServerHandler.Loggedin( slea, playerid, c, type);
                /*      */
                break;
            case ENTER_CASH_SHOP:
                /*  203 */
                InterServerHandler.enterCS(c, c.getPlayer(), false);
                /*      */
                break;
            case ENTER_MTS:
                /*  206 */
                if (MTSConfig.MTS_OPEN) {
                    /*  207 */
                    InterServerHandler.enterCS(c, c.getPlayer(), false, false);
                    /*      */
                } else {
                    /*  209 */
                    c.getPlayer().dropMessage(1, "拍卖正在整改中,暂时无法进入!");
                    /*  210 */
                    c.announce(MaplePacketCreator.enableActions());
                    /*      */
                }
                /*      */
                break;
            case MTS_OPERATION:
                /*  214 */
                MTSOperation.newMTSOperation( slea, c);
                /*      */
                break;
            case LEAVE_MTS:
                /*  217 */
                slea.readInt();
                /*  218 */
                CashShopOperation.LeaveCS( slea, c, c.getPlayer(), false);
                /*      */
                break;
            case CHANGE_PLAYER:
                /*  221 */
                InterServerHandler.ChangePlayer( slea, c);
                /*      */
                break;
            case LOGIN_AUTHKEY:
                /*  224 */
                LoginPasswordHandler.handlerAuth( slea, c);
                /*      */
                break;
            case MOVE_PLAYER:
                /*  227 */
                PlayerHandler.MovePlayer( slea, c, c.getPlayer());
                /*      */
                break;
            case CHAR_INFO_REQUEST:
                /*  230 */
                slea.readInt();
                /*  231 */
                PlayerHandler.CharInfoRequest(slea.readInt(), c, c.getPlayer());
                /*      */
                break;
            case CLOSE_RANGE_ATTACK:
            case RANGED_ATTACK:
            case MAGIC_ATTACK:
            case WARLOCK_MAGIC_ATTACK:
            case SUMMON_ATTACK:
            case PASSIVE_ENERGY:
            case CLUSTER_ATTACK:
                PlayerHandler.attackProcessing(slea, c, header);
                break;
            case CP_UserSpotlightAttack:
                /*  241 */
                PlayerHandler.attackProcessing( slea, c, header);
                /*      */
                break;
            case SPECIAL_MOVE:
                /*  244 */
                PlayerHandler.SpecialMove( slea, c, c.getPlayer());
                /*      */
                break;
            case PROFESSION_INFO:
                /*  247 */
                ItemMakerHandler.ProfessionInfo( slea, c, c.getPlayer());
                /*      */
                break;
            case CRAFT_DONE:
                /*  250 */
                ItemMakerHandler.CraftComplete( slea, c, c.getPlayer());
                /*      */
                break;
            case CRAFT_MAKE:
                /*  253 */
                ItemMakerHandler.CraftMake( slea, c, c.getPlayer());
                /*      */
                break;
            case CRAFT_EFFECT:
                /*  256 */
                ItemMakerHandler.CraftEffect( slea, c, c.getPlayer());
                /*      */
                break;
            case START_HARVEST:
                /*  259 */
                ItemMakerHandler.StartHarvest( slea, c, c.getPlayer());
                /*      */
                break;
            case STOP_HARVEST:
                /*  262 */
                ItemMakerHandler.StopHarvest( slea, c, c.getPlayer());
                /*      */
                break;
            case MAKE_EXTRACTOR:
                /*  265 */
                ItemMakerHandler.MakeExtractor( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_ENCHANTING:
                /*  268 */
                ItemScrollHandler.UseEquipEnchanting( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_ARCANE_FORCE_REQUEST:
                /*  271 */
                ItemScrollHandler.UserArcaneForceRequest( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_BAG:
                /*  274 */
                ItemMakerHandler.UseBag( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_RECIPE:
                /*  277 */
                ItemMakerHandler.UseRecipe( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_NEBULITE:
                /*  280 */
                InventoryHandler.UseNebulite( slea, c, c.getPlayer());
                /*      */
                break;
            case MOVE_ANDROID:
                /*  283 */
                PlayerHandler.MoveAndroid( slea, c, c.getPlayer());
                /*      */
                break;
            case SUB_LITTLEWHITE:
                /*  286 */
                SummonHandler.SubLittleWhite( slea, c.getPlayer());
                /*      */
                break;
            case FACE_EXPRESSION:
                /*  289 */
                PlayerHandler.ChangeEmotion(slea.readInt(), c.getPlayer());
                /*      */
                break;
            case FACE_ANDROID:
                /*  292 */
                PlayerHandler.ChangeAndroidEmotion(slea.readInt(), c.getPlayer());
                /*      */
                break;
            case TAKE_DAMAGE:
                /*  295 */
                TakeDamageHandler.TakeDamage( slea, c, c.getPlayer());
                /*      */
                break;
            case HEAL_OVER_TIME:
                /*  298 */
                PlayerHandler.Heal( slea, c.getPlayer());
                /*      */
                break;
            case CANCEL_BUFF:
                /*      */
                break;
            case CANCEL_ATTACK_BUFF:
                /*  302 */
                PlayerHandler.CancelBuffHandler(slea.readInt(), c.getPlayer());
                /*      */
                break;
            case ATTACK_BUFF:
                /*  305 */
                PlayerHandler.AttackBuff( slea, c.getPlayer());
                /*      */
                break;
            case MECH_CANCEL:
                /*  307 */
                PlayerHandler.CancelMech( slea, c.getPlayer());
                /*      */
                break;
            case USE_HOLY_FOUNTAIN:
                /*  310 */
                PlayersHandler.UseHolyFountain( slea, c, c.getPlayer());
                /*      */
                break;
            case CANCEL_ITEM_EFFECT:
                /*  313 */
                PlayerHandler.CancelItemEffect(slea.readInt(), c.getPlayer());
                /*      */
                break;
            case USE_CHAIR:
                /*  316 */
                PlayerHandler.UseChair( slea, c, c.getPlayer());
                /*      */
                break;
            case CANCEL_CHAIR:
                /*  319 */
                PlayerHandler.CancelChair(slea.readShort(), c, c.getPlayer());
                /*      */
                break;
            case USE_ITEM_EFFECT:
                /*  322 */
                PlayerHandler.UseItemEffect( slea, c, c.getPlayer());
                /*      */
                break;
            case WHEEL_OF_FORTUNE:
                /*      */
                
            /*      */
            break;
            case USE_TITLE_EFFECT:
                /*  327 */
                PlayerHandler.UseTitleEffect(slea.readInt(), c, c.getPlayer());
                /*      */
                break;
            case MICRO_BUFF_END_TIME:
                /*  330 */
                PlayerHandler.MicroBuffEndTime( slea, c.getPlayer());
                /*      */
                break;
            case USE_ACTIVATE_DAMAGE_SKIN:
                /*  333 */
                PlayerHandler.UseActivateDamageSkin( slea, c.getPlayer());
                /*      */
                break;
            case USE_ACTIVATE_DAMAGE_SKIN_PREMIUM:
                /*  336 */
                PlayerHandler.UseActivateDamageSkinPremium( slea, c.getPlayer());
                /*      */
                break;
            case OBTACLE_ATOM_COLLISION:
                /*      */
                
            /*      */
            break;
            case DEMIANOBJECT_MAKE_ENTER_ACK:
                /*  341 */
                PlayerHandler.DemianObjectMakeEnterAck( slea, c.getPlayer());
                /*      */
                break;
            case DEMIANOBJECT_NODE_END:
                /*  344 */
                PlayerHandler.DemianObjectNodeEnd( slea, c.getPlayer());
                /*      */
                break;
            case DEMIANOBJECT_ERR_RECREATE:
                /*      */
                
            /*      */
            break;
            case SKILL_EFFECT:
                /*  349 */
                PlayerHandler.SkillEffect( slea, c.getPlayer());
                /*      */
                break;
            case SUPER_CANNON_REQUEST:
                /*  352 */
                PlayerHandler.UserSupserCannotRequest( slea, c.getPlayer());
                /*      */
                break;
            case QUICK_SLOT:
                /*  355 */
                PlayerHandler.QuickSlot( slea, c.getPlayer());
                /*      */
                break;
            case PASSIVE_SKILL_INFO_UPDATE:
                /*  358 */
                PlayerHandler.PassiveskillInfoUpdate( slea, c, c.getPlayer());
                /*      */
                break;
            case MESO_DROP:
                /*  361 */
                c.getPlayer().updateTick(slea.readInt());
                /*  362 */
                PlayerHandler.DropMeso(slea.readInt(), c.getPlayer());
                /*      */
                break;
            case CHANGE_KEYMAP:
                /*  365 */
                PlayerHandler.ChangeKeymap( slea, c.getPlayer());
                /*      */
                break;
            case CHANGE_MAP:
                /*  368 */
                if (type == ServerType.商城服务器) {
                    /*  369 */
                    CashShopOperation.LeaveCS( slea, c, c.getPlayer(), true);
                    /*  370 */
                } else if (type == ServerType.拍卖服务器) {
                    /*  371 */
                    CashShopOperation.LeaveCS( slea, c, c.getPlayer(), false);
                    /*      */
                } else {
                    /*  373 */
                    PlayerHandler.ChangeMap( slea, c, c.getPlayer());
                    /*      */
                }
                /*      */
                break;
            case CHANGE_MAP_SPECIAL:
                /*  377 */
                slea.skip(1);
                /*  378 */
                PlayerHandler.ChangeMapSpecial(slea.readMapleAsciiString(), c, c.getPlayer());
                /*      */
                break;
            case USE_INNER_PORTAL:
                /*  381 */
                slea.skip(1);
                /*  382 */
                PlayerHandler.InnerPortal( slea, c, c.getPlayer());
                /*      */
                break;
            case TROCK_ADD_MAP:
                /*  385 */
                PlayerHandler.TrockAddMap( slea, c, c.getPlayer());
                /*      */
                break;
            case LIE_DETECTOR:
                /*      */
                
            /*      */
            break;
            case LIE_DETECTOR_SKILL:
                /*  391 */
                PlayersHandler.LieDetector( slea, c, c.getPlayer(), false);
                /*      */
                break;
            case LIE_DETECTOR_RESPONSE:
                /*  394 */
                PlayersHandler.LieDetectorResponse( slea, c);
                /*      */
                break;
            case LIE_DETECTOR_REFRESH:
                /*  397 */
                PlayersHandler.LieDetectorRefresh( slea, c);
                /*      */
                break;
            case USER_HOWLING_STORM_STACK:
                /*  400 */
                PlayerHandler.UserHowlingStormStack( slea, c.getPlayer(), true);
                /*      */
                break;
            case CROSS_ATTACK:
                /*  403 */
                PlayerHandler.CrossAttack( slea, c, c.getPlayer());
                /*      */
                break;
            case USER_HOWLING_STORM_STACK_ATTACK_REQUEST:
                /*  406 */
                PlayerHandler.UserHowlingStormStackAttackReuqest( slea, c.getPlayer(), false);
                /*      */
                break;
            case ADD_ATTACK_RESET:
                /*      */
                
            /*      */
            break;
            case ARAN_COMBO:
                /*  411 */
                PlayerHandler.AranCombo(c, c.getPlayer(), 5);
                /*      */
                break;
            case LOST_ARAN_COMBO:
                /*  414 */
                PlayerHandler.AranCombo(c, c.getPlayer(), -10);
                /*      */
                break;
            case SPECIAL_ATTACK:
                /*  420 */
                PlayerHandler.specialAttack( slea, c, c.getPlayer());
                /*      */
                break;
            case SKILL_MACRO:
                /*  423 */
                PlayerHandler.ChangeSkillMacro( slea, c.getPlayer());
                /*      */
                break;
            case GIVE_FAME:
                /*  426 */
                PlayersHandler.GiveFame( slea, c, c.getPlayer());
                /*      */
                break;
            case TRANSFORM_PLAYER:
                /*  429 */
                PlayersHandler.TransformPlayer( slea, c, c.getPlayer());
                /*      */
                break;
            case NOTE_ACTION:
                /*  432 */
                PlayersHandler.Note( slea, c.getPlayer());
                /*      */
                break;
            case USE_DOOR:
                /*  435 */
                PlayersHandler.UseDoor( slea, c.getPlayer());
                /*      */
                break;
            case USE_MECH_DOOR:
                /*  438 */
                PlayersHandler.UseMechDoor( slea, c.getPlayer());
                /*      */
                break;
            case DAMAGE_REACTOR:
                /*  441 */
                PlayersHandler.HitReactor( slea, c);
                /*      */
                break;
            case TOUCH_REACTOR:
                /*  444 */
                PlayersHandler.TouchReactor( slea, c);
                /*      */
                break;
            case USE_RUNE:
                /*  447 */
                PlayersHandler.UseRune( slea, c.getPlayer());
                /*      */
                break;
            case USE_RUNE_SKILL_REQ:
                /*  450 */
                PlayersHandler.UseRuneSkillReq( slea, c.getPlayer());
                /*      */
                break;
            case CLOSE_CHALKBOARD:
                /*  453 */
                c.getPlayer().setChalkboard(null);
                /*      */
                break;
            case ITEM_GATHER:
                /*  456 */
                InventoryHandler.ItemGather( slea, c);
                /*      */
                break;
            case ITEM_SORT:
                /*  459 */
                InventoryHandler.ItemSort( slea, c);
                /*      */
                break;
            case ITEM_MOVE:
                /*  462 */
                InventoryHandler.ItemMove( slea, c);
                /*      */
                break;
            case MOVE_BAG:
                /*  465 */
                InventoryHandler.MoveBag( slea, c);
                /*      */
                break;
            case SWITCH_BAG:
                /*  468 */
                InventoryHandler.SwitchBag( slea, c);
                /*      */
                break;
            case ITEM_MAKER:
                /*  471 */
                ItemMakerHandler.ItemMaker( slea, c);
                /*      */
                break;
            case ITEM_PICKUP:
                /*  474 */
                InventoryHandler.Pickup_Player( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_CASH_ITEM:
                /*  477 */
                UseCashItemHandler.handlePacket( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_ADDITIONAL_ADD_ITEM:
                /*  480 */
                InventoryHandler.UseAdditionalAddItem( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_ITEM:
                /*  483 */
                InventoryHandler.UseItem( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_COSMETIC:
                /*  486 */
                InventoryHandler.UseCosmetic( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_REDUCER:
                /*  489 */
                InventoryHandler.UseReducer( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_REDUCER_PRESTIGE:
                /*  492 */
                InventoryHandler.UseReducerPrestige( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_MAGNIFY_GLASS:
                /*  495 */
                InventoryHandler.UseMagnify( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_CRAFTED_CUBE:
                /*  498 */
                InventoryHandler.applyBlackCube( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_SCRIPTED_NPC_ITEM:
                /*  501 */
                InventoryHandler.UseScriptedNPCItem( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_RETURN_SCROLL:
                /*  504 */
                InventoryHandler.UseReturnScroll( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_UPGRADE_SCROLL:
            case USE_EXITEM_UPGRADE:
                /*  508 */
                ItemScrollHandler.handlePacket( slea, c, c.getPlayer(), false);
                /*      */
                break;
            case USE_FLAG_SCROLL:
                /*  511 */
                ItemScrollHandler.handlePacket( slea, c, c.getPlayer(), true);
                /*      */
                break;
            case USE_POTENTIAL_SCROLL:
            case USE_POTENTIAL_ADD_SCROLL:
            case USE_EQUIP_SCROLL:
                /*  516 */
                ItemScrollHandler.handlePacket( slea, c, c.getPlayer(), false);
                /*      */
                break;
            case USE_ADDITIONAL_ITEM:
                /*  519 */
                InventoryHandler.UseAdditionalItem( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_SOULS_SCROLL:
                /*  522 */
                InventoryHandler.UseSoulEnchanter( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_SOUL_MARBLE:
                /*  525 */
                InventoryHandler.UseSoulScroll( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_MIRACLE_CUBE:
                /*  528 */
                InventoryHandler.UseMiracleCube( slea, c.getPlayer());
                /*      */
                break;
            case USE_SUMMON_BAG:
                /*  531 */
                InventoryHandler.UseSummonBag( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_TREASUER_CHEST:
                /*  534 */
                InventoryHandler.UseTreasureChest( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_SKILL_BOOK:
                /*  537 */
                c.getPlayer().updateTick(slea.readInt());
                /*  538 */
                InventoryHandler.UseSkillBook((short) (byte) slea.readShort(), slea.readInt(), c, c.getPlayer());
                /*      */
                break;
            case USE_SP_RESET:
                /*  541 */
                c.getPlayer().updateTick(slea.readInt());
                /*  542 */
                InventoryHandler.UseSpReset((short) (byte) slea.readShort(), slea.readInt(), c, c.getPlayer());
                /*      */
                break;
            case USE_AP_RESET:
                /*  545 */
                c.getPlayer().updateTick(slea.readInt());
                /*  546 */
                InventoryHandler.UseApReset((short) (byte) slea.readShort(), slea.readInt(), c, c.getPlayer());
                /*      */
                break;
            case USE_CATCH_ITEM:
                /*  549 */
                InventoryHandler.UseCatchItem( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_MOUNT_FOOD:
                /*  552 */
                InventoryHandler.UseMountFood( slea, c, c.getPlayer());
                /*      */
                break;
            case REWARD_ITEM:
                /*  555 */
                InventoryHandler.UseRewardItem((short) (byte) slea.readShort(), slea.readInt(), c, c.getPlayer());
                /*      */
                break;
            case BUY_CROSS_ITEM:
                /*  558 */
                InventoryHandler.BuyCrossHunterItem( slea, c, c.getPlayer());
                /*      */
                break;
            case MOVE_LIFE:
                /*  561 */
                MobHandler.MoveMonster(slea, c, c.getPlayer());
                /*      */
                break;
            case AUTO_AGGRO:
                /*  564 */
                MobHandler.AutoAggro(slea.readInt(), c.getPlayer());
                /*      */
                break;
            case MOB_SKILLDELAY_END:
                /*  567 */
                MobHandler.MobSkillDelayEnd( slea, c.getPlayer());
                /*      */
                break;
            case MONSTER_TIME_BOMB_END:
                /*  570 */
                MobHandler.MobTimeBombEnd( slea, c.getPlayer());
                /*      */
                break;
            case MONSTER_ESCORT_COLLISION:
                /*  573 */
                MobHandler.MobEscortCollision( slea, c.getPlayer());
                /*      */
                break;
            case FRIENDLY_DAMAGE:
                /*  576 */
                MobHandler.FriendlyDamage( slea, c.getPlayer());
                /*      */
                break;
            case MONSTER_BOMB:
                /*  579 */
                MobHandler.MonsterBomb(slea.readInt(), c.getPlayer());
                /*      */
                break;
            case MONSTER_BOMB_COLLISION_GROUP:
                /*      */
                
            /*      */
            break;
            case MONSTER_SPECIAL_SKILL:
                /*  584 */
                MobHandler.MonsterSpecialSkill( slea, c.getPlayer());
                /*      */
                break;
            case NPC_SHOP:
                /*  587 */
                NPCHandler.NPCShop( slea, c, c.getPlayer());
                /*      */
                break;
            case NPC_TALK:
                /*  590 */
                NPCHandler.NPCTalk( slea, c, c.getPlayer());
                /*      */
                break;
            case NPC_TALK_MORE:
                /*  593 */
                NPCHandler.NPCMoreTalk( slea, c);
                /*      */
                break;
            case NPC_ACTION:
                /*  596 */
                NPCHandler.NPCAnimation( slea, c);
                /*      */
                break;
            case QUEST_ACTION:
                /*  599 */
                NPCHandler.QuestAction( slea, c, c.getPlayer());
                /*      */
                break;
            case REISSUE_MEDAL:
                /*  602 */
                PlayerHandler.ReIssueMedal( slea, c, c.getPlayer());
                /*      */
                break;
            case STORAGE:
                /*  605 */
                NPCHandler.Storage( slea, c, c.getPlayer());
                /*      */
                break;
            case GENERAL_CHAT:
                /*  608 */
                if (c.getPlayer() != null && c.getPlayer().getMap() != null) {
                    /*  609 */
                    c.getPlayer().updateTick(slea.readInt());
                    /*  610 */
                    ChatHandler.GeneralChat(slea.readMapleAsciiString(), slea.readByte(), c, c.getPlayer());
                    /*      */
                }
                /*      */
                break;
            case ITEM_CHAT:
                /*  614 */
                if (c.getPlayer() != null && c.getPlayer().getMap() != null) {
                    /*  615 */
                    c.getPlayer().updateTick(slea.readInt());
                    /*  616 */
                    ChatHandler.ItemChat( slea, c, c.getPlayer());
                    /*      */
                }
                /*      */
                break;
            case PARTYCHAT:
                /*  620 */
                ChatHandler.Others( slea, c, c.getPlayer());
                /*      */
                break;
            case WHISPER:
                /*  623 */
                ChatHandler.Whisper_Find( slea, c);
                /*      */
                break;
            case MESSENGER:
                /*  626 */
                ChatHandler.Messenger( slea, c);
                /*      */
                break;
            case SHOW_LOVE_RANK:
                /*  629 */
                ChatHandler.ShowLoveRank( slea, c);
                /*      */
                break;
            case SPAWN_ARROWS_TURRET:
                /*  632 */
                PlayerHandler.SpawnArrowsTurret( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_GROWTH_HELPER_REQUEST:
                /*  635 */
                PlayerHandler.UserGrowthHelperRequest( slea, c, c.getPlayer());
                /*      */
                break;
            case ENTER_STARTPLANET:
                /*  638 */
                InterServerHandler.EnterMTS(c, c.getPlayer());
                /*      */
                break;
            case GAME_EXIT:
                /*  641 */
                PlayerHandler.GameExit(c);
                /*      */
                break;
            case TRACK_FLAMES:
                /*  644 */
                PlayerHandler.showTrackFlames( slea, c, c.getPlayer());
                /*      */
                break;
            case AUTO_ASSIGN_AP:
                /*  647 */
                StatsHandling.AutoAssignAP( slea, c, c.getPlayer());
                /*      */
                break;
            case DISTRIBUTE_AP:
                /*  650 */
                StatsHandling.DistributeAP( slea, c, c.getPlayer());
                /*      */
                break;
            case DISTRIBUTE_SP:
                /*  653 */
                StatsHandling.DistributeSP( slea, c, c.getPlayer());
                /*      */
                break;
            case DISTRIBUTE_HYPER_AP:
                /*  656 */
                c.getPlayer().updateTick(slea.readInt());
                /*  657 */
                StatsHandling.DistributeHyperSP(slea.readInt(), c, c.getPlayer(), true);
                /*      */
                break;
            case DISTRIBUTE_HYPER_SP:
                /*  660 */
                c.getPlayer().updateTick(slea.readInt());
                /*  661 */
                StatsHandling.DistributeHyperSP(slea.readInt(), c, c.getPlayer(), false);
                /*      */
                break;
            case RESET_HYPER_SP:
                /*  664 */
                StatsHandling.ResetHyperSP( slea, c, c.getPlayer());
                /*      */
                break;
            case RESET_HYPER_AP:
                /*  667 */
                StatsHandling.ResetHyperAP( slea, c, c.getPlayer());
                /*      */
                break;
            case PLAYER_INTERACTION:
                /*  670 */
                PlayerInteractionHandler.PlayerInteraction( slea, c, c.getPlayer());
                /*      */
                break;
            case GUILD_OPERATION:
                /*  673 */
                GuildHandler.Guild( slea, c);
                /*      */
                break;
            case DENY_GUILD_REQUEST:
                /*  676 */
                slea.skip(1);
                /*  677 */
                GuildHandler.DenyGuildRequest(slea.readMapleAsciiString(), c);
                /*      */
                break;
            case GUILD_APPLY:
                /*  680 */
                GuildHandler.GuildApply( slea, c);
                /*      */
                break;
            case ACCEPT_GUILD_APPLY:
                /*  683 */
                GuildHandler.AcceptGuildApply( slea, c);
                /*      */
                break;
            case DENY_GUILD_APPLY:
                /*  686 */
                GuildHandler.DenyGuildApply( slea, c);
                /*      */
                break;
            case TOWER_RANK_REQUEST:
                /*  689 */
                PlayersHandler.getTowerRankRequest( slea, c, c.getPlayer());
                /*      */
                break;
            case QUICK_MOVE:
                /*  698 */
                NPCHandler.OpenQuickMoveNpc( slea, c);
                /*      */
                break;
            case BBS_OPERATION:
                /*  701 */
                BBSHandler.BBSOperation( slea, c);
                /*      */
                break;
            case SELECT_JAGUAR:
                /*  704 */
                PlayerHandler.selectJaguar( slea, c, c.getPlayer());
                /*      */
                break;
            case GIVE_KSPSYCHIC:
                /*  707 */
                PlayerHandler.showKSPsychicGrabHanlder( slea, c, c.getPlayer());
                /*      */
                break;
            case ATTACK_KSPSYCHIC:
                /*  710 */
                PlayerHandler.showKSPsychicAttackHanlder( slea, c, c.getPlayer());
                /*      */
                break;
            case CANCEL_KSPSYCHIC:
                /*  713 */
                PlayerHandler.showKSPsychicReleaseHanlder( slea, c, c.getPlayer());
                /*      */
                break;
            case GIVE_KSULTIMATE:
                /*  716 */
                PlayerHandler.showGiveKSUltimate( slea, c, c.getPlayer());
                /*      */
                break;
            case ATTACK_KSULTIMATE:
                /*  719 */
                PlayerHandler.showAttackKSUltimate( slea, c, c.getPlayer());
                /*      */
                break;
            case MIST_KSULTIMAT:
                /*  722 */
                PlayerHandler.showKSMonsterEffect( slea, c, c.getPlayer());
                /*      */
                break;
            case CANCEL_KSULTIMATE:
                /*  725 */
                PlayerHandler.showCancelKSUltimate( slea, c, c.getPlayer());
                /*      */
                break;
            case CP_PsychicOverRequest:
                /*  728 */
                PlayerHandler.CP_PsychicOverRequest( slea, c, c.getPlayer());
                /*      */
                break;
            case PARTY_OPERATION:
                /*  731 */
                PartyHandler.PartyOperation( slea, c);
                /*      */
                break;
            case DENY_PARTY_REQUEST:
                /*  734 */
                PartyHandler.DenyPartyRequest( slea, c);
                /*      */
                break;
            case ALLOW_PARTY_INVITE:
                /*  737 */
                PartyHandler.AllowPartyInvite( slea, c);
                /*      */
                break;
            case BUDDYLIST_MODIFY:
                /*  740 */
                BuddyListHandler.BuddyOperation( slea, c);
                /*      */
                break;
            case BUY_CS_ITEM:
                /*  749 */
                BuyCashItemHandler.BuyCashItem( slea, c, c.getPlayer());
                /*      */
                break;
            case COUPON_CODE:
                /*  752 */
                CouponCodeHandler.handlePacket( slea, c, c.getPlayer());
                /*      */
                break;
            case CANCEL_SKY_SWORD:
                /*  755 */
                PlayerHandler.CANCEL_SKY_SWORD( slea, c.getPlayer());
                /*      */
                break;
            case CS_UPDATE:
                /*  758 */
                CashShopOperation.CSUpdate(c);
                /*      */
                break;
            case SEND_CS_GIFI:
                /*  761 */
                BuyCashItemHandler.商城送礼( slea, c, c.getPlayer());
                /*      */
                break;
            case OPEN_AVATAR_RANDOM_BOX:
                /*      */
                
            /*      */
            break;
            case USE_POT:
                /*  772 */
                ItemMakerHandler.UsePot( slea, c);
                /*      */
                break;
            case CLEAR_POT:
                /*  775 */
                ItemMakerHandler.ClearPot( slea, c);
                /*      */
                break;
            case FEED_POT:
                /*  778 */
                ItemMakerHandler.FeedPot( slea, c);
                /*      */
                break;
            case CURE_POT:
                /*  781 */
                ItemMakerHandler.CurePot( slea, c);
                /*      */
                break;
            case REWARD_POT:
                /*  784 */
                ItemMakerHandler.RewardPot( slea, c);
                /*      */
                break;
            case MOVE_LITTLEWHITE:
                /*  787 */
                SummonHandler.MoveLittleWhite( slea, c.getPlayer());
                /*      */
                break;
            case DAMAGE_SUMMON:
                /*  790 */
                SummonHandler.DamageSummon( slea, c.getPlayer());
                /*      */
                break;
            case MOVE_SUMMON:
                /*  793 */
                SummonHandler.MoveSummon( slea, c.getPlayer());
                /*      */
                break;
            case MOVE_DRAGON:
                /*  796 */
                SummonHandler.MoveDragon( slea, c.getPlayer());
                /*      */
                break;
            case DRAGON_FLY:
                /*  799 */
                SummonHandler.DragonFly( slea, c.getPlayer());
                /*      */
                break;
            case SUB_SUMMON:
                /*  802 */
                SummonHandler.SubSummon( slea, c.getPlayer());
                /*      */
                break;
            case REMOVE_SUMMON:
                /*  805 */
                SummonHandler.RemoveSummon( slea, c);
                /*      */
                break;
            case SPAWN_PET:
                /*  808 */
                PetHandler.SpawnPet( slea, c, c.getPlayer());
                /*      */
                break;
            case PET_AUTO_BUFF:
                /*  811 */
                PetHandler.Pet_AutoBuff( slea, c, c.getPlayer());
                /*      */
                break;
            case MOVE_PET:
                /*  814 */
                PetHandler.MovePet( slea, c.getPlayer());
                /*      */
                break;
            case PET_CHAT:
                /*  817 */
                PetHandler.PetChat( slea, c, c.getPlayer());
                /*      */
                break;
            case PET_COMMAND:
                /*  820 */
                PetHandler.PetCommand( slea, c, c.getPlayer());
                /*      */
                break;
            case PET_FOOD:
                /*  823 */
                PetHandler.PetFood( slea, c, c.getPlayer());
                /*      */
                break;
            case PET_LOOT:
                /*  826 */
                InventoryHandler.Pickup_Pet( slea, c, c.getPlayer());
                /*      */
                break;
            case PET_AUTO_POT:
                /*  829 */
                PetHandler.Pet_AutoPotion( slea, c, c.getPlayer());
                /*      */
                break;
            case PET_EXCEPTION_LIST:
                /*  832 */
                PetHandler.PetExcludeItems( slea, c, c.getPlayer());
                /*      */
                break;
            case PET_AOTO_EAT:
                /*  835 */
                slea.skip(4);
                /*  836 */
                PetHandler.PetFood( slea, c, c.getPlayer());
                /*      */
                break;
            case ALLOW_PET_LOOT:
                /*  839 */
                PetHandler.AllowPetLoot( slea, c, c.getPlayer());
                /*      */
                break;
            case ALLOW_PET_AOTO_EAT:
                /*  842 */
                PetHandler.AllowPetAutoEat( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_OPTION_CHANGE_REQUEST:
                /*  845 */
                UseHammerHandler.GoldHammerResponse( slea, c);
                /*      */
                break;
            case DUEY_ACTION:
                /*  848 */
                DueyHandler.DueyOperation( slea, c);
                /*      */
                break;
            case USE_HIRED_MERCHANT:
                /*  851 */
                HiredMerchantHandler.UseHiredMerchant(c, true);
                /*      */
                break;
            case MERCH_ITEM_STORE:
                /*  854 */
                HiredMerchantHandler.MerchantItemStore( slea, c);
                /*      */
                break;
            case FISHING:
                /*  857 */
                HiredFisherHandler.INSTANCE.UseHiredFisher( slea, c.getPlayer());
                /*      */
                break;
            case CANCEL_DEBUFF:
                /*      */
                
            /*      */
            break;
            case REPAIR:
                /*  863 */
                NPCHandler.repair( slea, c);
                /*      */
                break;
            case REPAIR_ALL:
                /*  866 */
                NPCHandler.repairAll(c);
                /*      */
                break;
            case OWL:
                /*  869 */
                InventoryHandler.Owl( slea, c);
                /*      */
                break;
            case OWL_WARP:
                /*  872 */
                InventoryHandler.OwlWarp( slea, c);
                /*      */
                break;
            case USE_OWL_MINERVA:
                /*  875 */
                InventoryHandler.OwlMinerva( slea, c);
                /*      */
                break;
            case RPS_GAME:
                /*  878 */
                NPCHandler.RPSGame( slea, c);
                /*      */
                break;
            case FOLLOW_REQUEST:
                /*  887 */
                PlayersHandler.FollowRequest( slea, c);
                /*      */
                break;
            case AUTO_FOLLOW_REPLY:
            case FOLLOW_REPLY:
                /*  891 */
                PlayersHandler.FollowReply( slea, c);
                /*      */
                break;
            case RING_ACTION:
                /*  894 */
                PlayersHandler.RingAction( slea, c);
                /*      */
                break;
            case SOLOMON:
                /*  924 */
                PlayersHandler.Solomon( slea, c);
                /*      */
                break;
            case GACH_EXP:
                /*  927 */
                PlayersHandler.GachExp( slea, c);
                /*      */
                break;
            case PARTY_SEARCH_START:
                /*  930 */
                PartyHandler.MemberSearch( slea, c);
                /*      */
                break;
            case PARTY_SEARCH_STOP:
                /*  933 */
                PartyHandler.PartySearch( slea, c);
                /*      */
                break;
            case EXPEDITION_LISTING:
                /*  936 */
                PartyHandler.PartyListing( slea, c);
                /*      */
                break;
            case EXPEDITION_OPERATION:
                /*  939 */
                PartyHandler.Expedition( slea, c);
                /*      */
                break;
            case USE_TELE_ROCK:
                /*  942 */
                InventoryHandler.TeleRock( slea, c);
                /*      */
                break;
            case PAM_SONG:
                /*  945 */
                InventoryHandler.PamSong( slea, c);
                /*      */
                break;
            case REPORT:
                /*  948 */
                PlayersHandler.Report( slea, c);
                /*      */
                break;
            case REMOTE_STORE:
                /*  951 */
                HiredMerchantHandler.RemoteStore( slea, c);
                /*      */
                break;
            case SHIKONGJUAN:
                /*  954 */
                PlayerHandler.UseChronosphere( slea, c, c.getPlayer());
                /*      */
                break;
            case PLAYER_UPDATE:
                /*  957 */
                PlayerHandler.PlayerUpdate(c, c.getPlayer());
                /*      */
                break;
            case CHANGE_MARKET_MAP:
                /*  960 */
                PlayerHandler.ChangeMarketMap( slea, c, c.getPlayer());
                /*      */
                break;
            case DEL_TEACH_SKILL:
                /*  963 */
                PlayerHandler.DelTeachSkill( slea, c, c.getPlayer());
                /*      */
                break;
            case SET_TEACH_SKILL:
                /*  966 */
                PlayerHandler.SetTeachSkill( slea, c, c.getPlayer());
                /*      */
                break;
            case SET_CHAR_CASH:
                /*  969 */
                PlayerHandler.showPlayerCash( slea, c);
                /*      */
                break;
            case OPEN_WORLDMAP:
                /*  972 */
                c.announce(MaplePacketCreator.openWorldMap());
                /*      */
                break;
            case DAMAGESKIN_OPERATION:
                /*  984 */
                PlayerHandler.DamageSkinOp( slea, c.getPlayer());
                /*      */
                break;
            case USE_HAMMER:
                /*  987 */
                UseHammerHandler.UseHammer( slea, c);
                /*      */
                break;
            case CP_GoldHammerComplete:
                /*  990 */
                UseHammerHandler.GoldHammerResponse( slea, c);
                /*      */
                break;
            case HAMMER_RESPONSE:
                /*  993 */
                UseHammerHandler.HammerResponse( slea, c);
                /*      */
                break;
            case BATTLE_STATISTICS:
                /*  996 */
                PlayerHandler.startBattleStatistics( slea, c);
                /*      */
                break;
            case MEMORY_SKILL_CHOOSE:
                /*  999 */
                PhantomMemorySkill.MemorySkillChoose( slea, c);
                /*      */
                break;
            case MEMORY_SKILL_CHANGE:
                /* 1002 */
                PhantomMemorySkill.MemorySkillChange( slea, c);
                /*      */
                break;
            case MEMORY_SKILL_OBTAIN:
                /* 1005 */
                PhantomMemorySkill.MemorySkillObtain( slea, c);
                /*      */
                break;
            case PLAYER_VIEW_RANGE:
                /* 1008 */
                by2 = slea.readByte();
                /* 1009 */
                if (by2 == 1)
                    /* 1010 */ c.sendEnableActions();
                /*      */
                break;
            case CHANGE_POTENTIAL:
                /* 1014 */
                ItemScrollHandler.ChangeWeaponPotential( slea, c, c.getPlayer());
                /*      */
                break;
            case CHANGE_POTENTIAL_WP:
                /* 1017 */
                ItemScrollHandler.ChangeWeaponPotential_WP( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_TEMPEST_BLADES:
                /* 1020 */
                PlayerHandler.useTempestBlades( slea, c, c.getPlayer());
                /*      */
                break;
            case UNKNOWN_168:
                /* 1027 */
                c.announce(MaplePacketCreator.sendUnkPacket1FC());
                /*      */
                break;
            case QUICK_BUY_CS_ITEM:
                /* 1030 */
                PlayerHandler.quickBuyCashShopItem( slea, c, c.getPlayer());
                /*      */
                break;
            case SYSTEM_PROCESS_LIST:
                /* 1033 */
                SystemProcess.SystemProcess( slea, c, c.getPlayer());
                /*      */
                break;
            case FAMILIAR_OPERATION:
                /* 1036 */
                PlayerHandler.useFamiliarCard( slea, c, c.getPlayer());
                /*      */
                break;
            case SOUL_MODE:
                /* 1039 */
                PlayerHandler.updateSoulEffect( slea, c, c.getPlayer());
                /*      */
                break;
            case USE_TOWERCHAIR_SETTING:
                /* 1042 */
                PlayerHandler.UseTowerChairSetting( slea, c, c.getPlayer());
                /*      */
                break;
            case VMATRIX_MAKE_REQUEST:
                /* 1045 */
                PlayerHandler.VCoreOperation( slea, c.getPlayer());
                /*      */
                break;
            case VMATRIX_HELP_REQUEST:
                /* 1048 */
                PlayerHandler.VmatrixHelpRequest( slea, c.getPlayer());
                /*      */
                break;
            case CP_OPEN_VMATRIX_WINDOW_REQUEST:
                /* 1051 */
                PlayerHandler.VmatrixwindowRequest( slea, c.getPlayer());
                /*      */
                break;
            case FORCE_TARGET_REQUEST:
                /* 1054 */
                PlayerHandler.ForceTargetRequest( slea, c.getPlayer());
                /*      */
                break;
            case SIGNIN_OPERATION:
                /* 1057 */
                PlayerHandler.openSigin( slea, c, c.getPlayer());
                /*      */
                break;
            case USER_CANNON_GUN:
                /* 1060 */
                PlayerHandler.UserCannonGun( slea, c.getPlayer());
                /*      */
                break;
            case MULTI_SKILL_ATTACK_REQUEST:
                /* 1063 */
                PlayerHandler.MulitSkillAttackRequest( slea, c.getPlayer());
                /*      */
                break;
            case MULTI_SKILL_CHARGE_REQUEST:
                /* 1066 */
                PlayerHandler.MultiSkillChargeRequest( slea, c.getPlayer());
                /*      */
                break;
            case GIVE_SPOTLIGHT_BUFF:
                /* 1069 */
                PlayerHandler.GiveSpotlightBuff( slea, c, c.getPlayer());
                /*      */
                break;
            case POTION_POT_USE:
                /* 1072 */
                PotionPotHandler.PotionPotUse( slea, c, c.getPlayer());
                /*      */
                break;
            case POTION_POT_ADD:
                /* 1075 */
                PotionPotHandler.PotionPotAdd( slea, c, c.getPlayer());
                /*      */
                break;
            case POTION_POT_MODE:
                /* 1078 */
                PotionPotHandler.PotionPotMode( slea, c, c.getPlayer());
                /*      */
                break;
            case POTION_POT_INCR:
                /* 1081 */
                PotionPotHandler.PotionPotIncr( slea, c, c.getPlayer());
                /*      */
                break;
            case APPLY_HYUNCUBE:
                /* 1084 */
                InventoryHandler.applyHyunCube( slea, c, c.getPlayer());
                /*      */
                break;
            case CHANGE_ZERO_LOOK:
                /* 1087 */
                PlayerHandler.changeZeroLook( slea, c, c.getPlayer(), false);
                /*      */
                break;
            case CHANGE_ZERO_LOOK_END:
                /* 1090 */
                PlayerHandler.changeZeroLook( slea, c, c.getPlayer(), true);
                /*      */
                break;
            case EXTRA_ATTACK:
                /* 1093 */
                PlayerHandler.ExtraAttack( slea, c, c.getPlayer());
                /*      */
                break;
            case SHOW_FIREWALL_REQUEST:
                /* 1096 */
                PlayerHandler.spawnSpecial( slea, c, c.getPlayer());
                /*      */
                break;
            case MOVE_ENERGY:
                /* 1099 */
                PlayerHandler.MoveEnergyBall( slea, c);
                /*      */
                break;
            case HIDDEN_TAIL_ADN_EAR:
                /* 1102 */
                if (c.getPlayer() != null)
                    /* 1103 */ c.getPlayer().hiddenTailAndEar(slea.readInt());
                /*      */
                break;
            case DF_COMBO:
                /* 1107 */
                PlayerHandler.absorbingDF( slea, c, c.getPlayer());
                /*      */
                break;
            case USER_TRUMP_SKILL_ACTION_REQUEST:
                /* 1110 */
                PlayerHandler.UserTrumpSkillActionRequest( slea, c.getPlayer());
                /*      */
                break;
            case DOT_HEAL_HP_REQUEST:
                /* 1113 */
                PlayerHandler.DotHealHPRequest(c.getPlayer());
                /*      */
                break;
            case EFFECT_SWITCH:
                /* 1116 */
                PlayerHandler.effectSwitch( slea, c);
                /*      */
                break;
            case CALL_FRIENDS:
                /* 1119 */
                PlayerHandler.callFriends( slea, c, c.getPlayer());
                /*      */
                break;
            case SELECT_CHAIR:
                /* 1122 */
                PlayerHandler.selectChair( slea, c, c.getPlayer());
                /*      */
                break;
            case TAP_JOY_RESPONSE:
                /* 1125 */
                UseCashItemHandler.TapJoyResponse( slea, c.getPlayer());
                /*      */
                break;
            case TAP_JOY_DONE:
                /* 1128 */
                UseCashItemHandler.TapJoyDone( slea, c.getPlayer());
                /*      */
                break;
            case TAP_JOY_NEXT_STAGE:
                /* 1131 */
                UseCashItemHandler.TapJoyNextStage( slea, c.getPlayer());
                /*      */
                break;
            case STAR_REWARD:
                /* 1134 */
                PlayerHandler.Star_Reward( slea, c.getPlayer());
                /*      */
                break;
            case YHYR_ENERGY:
                /* 1137 */
                PlayerHandler.YhyrEnergy( slea, c, c.getPlayer());
                /*      */
                break;
            case AUTO_NZ:
                /* 1140 */
                if (c.getPlayer() != null)
                    /* 1141 */ c.getPlayer().ChangeAutoAtkType(slea.readInt());
                /*      */
                break;
            case LUCID_SCREEN_ATK_END:
                /* 1145 */
                PlayerHandler.BossScreenAtkEnd( slea, c, c.getPlayer());
                /*      */
                break;
            case DEMIAN_FIYINGSWORD_ATK:
                /* 1148 */
                PlayerHandler.DemianFiyingSwordAtk( slea, c.getPlayer());
                /*      */
                break;
            case DEMIAN_FIYINGSWORD_REBIRTH:
                /* 1151 */
                PlayerHandler.DemianObjectNodeEnd( slea, c.getPlayer());
                /*      */
                break;
            case CANCEL_KEYDOWNSKILL:
                /* 1154 */
                PlayerHandler.CancelKeyDownSkillHandler( slea, c.getPlayer());
                /*      */
                break;
            case PEACE_ENVOY_LASTATTACK:
                /* 1157 */
                PlayerHandler.PeaceEnvoyLastAttack( slea, c, c.getPlayer());
                /*      */
                break;
            case OPEN_MAPLE_UNION_REQUEST:
                /* 1160 */
                PlayerHandler.OpenMapleUnionRequest( slea, c.getPlayer());
                /*      */
                break;
            case MAPLE_UNION_REQUEST:
                /* 1163 */
                PlayerHandler.MapleUnionRequest( slea, c.getPlayer());
                /*      */
                break;
            case LOAD_MAPLE_UNION:
                /* 1166 */
                PlayerHandler.LoadMapleUnion( slea, c.getPlayer());
                /*      */
                break;
            case RUN_SCRIPT:
                /* 1169 */
                PlayerHandler.RunScript( slea, c);
            default:
                log.error("[未处理封包] Recv " + header.toString() + " [" + HexTool.getOpcodeToString(header.getValue()) + "]");
                /*      */
        }
        /*      */
    }

    /*      */
    /*      */
    public void channelActive(ChannelHandlerContext ctx) throws Exception {
        /* 1182 */
        String address = ctx.channel().remoteAddress().toString().split(":")[0];
        /* 1183 */
        if (BlockIPList.contains(address)) {
            /* 1184 */
            ctx.channel().close();
            /*      */
            
            /*      */
        }
        /* 1187 */
        if (!address.equals("/127.0.0.1")) {
            /*      */
            byte count;
            /* 1188 */
            Pair<Long, Byte> track = this.tracker.get(address);
            /* 1190 */
            if (track == null) {
                /* 1191 */
                count = 1;
                /*      */
            } else {
                /* 1193 */
                count = ((Byte) track.right).byteValue();
                /* 1194 */
                long difference = System.currentTimeMillis() - ((Long) track.left).longValue();
                /* 1195 */
                if (difference < 2000L) {
                    /* 1196 */
                    count = (byte) (count + 1);
                    /* 1197 */
                } else if (difference > 20000L) {
                    /* 1198 */
                    count = 1;
                    /*      */
                }
                /* 1200 */
                if (count > 5) {
                    /* 1201 */
                    BlockIPList.add(address);
                    /* 1202 */
                    this.tracker.remove(address);
                    /* 1203 */
                    ctx.channel().close();
                    /*      */
                    
                    /*      */
                }
                /*      */
            }
            /* 1207 */
            this.tracker.put(address, new Pair(Long.valueOf(System.currentTimeMillis()), Byte.valueOf(count)));
            /*      */
        }
        /* 1211 */
        if (this.channel > -1) {
            /* 1212 */
            if (ChannelServer.getInstance(this.channel).isShutdown()) {
                /* 1213 */
                ctx.channel().close();
                /*      */
                
                /*      */
            }
            /* 1216 */
        } else if (this.type == ServerType.商城服务器) {
            /* 1217 */
            if (CashShopServer.isShutdown()) {
                /* 1218 */
                ctx.channel().close();
                /*      */
                
                /*      */
            }
            /* 1221 */
        } else if (this.type == ServerType.登录服务器) {
            /* 1222 */
            if (LoginServer.isShutdown()) {
                /* 1223 */
                ctx.channel().close();
                /*      */
                
                /*      */
            }
            /* 1226 */
        } else if (this.type == ServerType.聊天服务器 &&
                /* 1227 */       ChatServer.isShutdown()) {
            /* 1228 */
            ctx.channel().close();
            /*      */
            
            /*      */
        }
        /* 1233 */
        byte[] ivRecv = {70, 114, 122, 82};
        /* 1234 */
        byte[] ivSend = {82, 48, 120, 115};
        /* 1235 */
        ivRecv[3] = (byte) (int) (Math.random() * 255.0D);
        /* 1236 */
        ivSend[3] = (byte) (int) (Math.random() * 255.0D);
        /* 1237 */
        MapleAESOFB sendCypher = new MapleAESOFB(ivSend, (short) (65535 - ServerConfig.LOGIN_MAPLE_VERSION));
        /* 1238 */
        MapleAESOFB recvCypher = new MapleAESOFB(ivRecv, ServerConfig.LOGIN_MAPLE_VERSION);
        /* 1239 */
        MapleClient client = new MapleClient(sendCypher, recvCypher, ctx.channel());
        /* 1240 */
        client.setSessionId(Randomizer.nextLong());
        /* 1241 */
        client.setChannel(this.channel);
        /* 1242 */
        client.setWorld(this.world);
        /* 1244 */
        ctx.channel().writeAndFlush(LoginPacket.getHello(ServerConfig.LOGIN_MAPLE_VERSION, ivSend, ivRecv, this.type));
        /* 1246 */
        ctx.channel().attr(MapleClient.CLIENT_KEY).set(client);
        /* 1248 */
        if (ServerConstants.isShowPacket()) {
            /* 1249 */
            RecvPacketOpcode.reloadValues();
            /* 1250 */
            SendPacketOpcode.reloadValues();
            /* 1251 */
            CashShopOpcode.reloadValues();
            /*      */
        }
        /* 1254 */
        StringBuilder sb = new StringBuilder();
        /* 1255 */
        if (this.channel > -1) {
            /* 1256 */
            sb.append("[频道服务器] 频道 ").append(this.channel).append(" : ");
            /* 1257 */
        } else if (this.type == ServerType.商城服务器) {
            /* 1258 */
            sb.append("[商城服务器] ");
            /* 1259 */
        } else if (this.type == ServerType.聊天服务器) {
            /* 1260 */
            sb.append("[聊天服务器]");
            /*      */
        } else {
            /* 1262 */
            sb.append("[登录服务器] ");
            /*      */
        }
        /* 1264 */
        sb.append("客户端地址 ").append(address).append(" 已连接到服务端");
        /* 1265 */
        System.out.println(sb.toString());
        /*      */
    }

    /*      */
    /*      */
    public void channelInactive(ChannelHandlerContext ctx) throws Exception {
        /* 1271 */
        MapleClient client = (MapleClient) ctx.channel().attr(MapleClient.CLIENT_KEY).get();
        /* 1272 */
        if (client != null)
            /*      */ try {
            /* 1274 */
            client.disconnect(true, ServerType.商城服务器.equals(this.type));
            /* 1275 */
        } catch (Throwable t) {
            /* 1276 */
            log.error("连接异常关闭", t);
            /*      */
        } finally {
            /* 1278 */
            ctx.channel().attr(MapleClient.CLIENT_KEY).set(null);
            /* 1279 */
            ctx.channel().attr(MaplePacketDecoder.DECODER_STATE_KEY).set(null);
            /* 1280 */
            ctx.channel().close();
            /*      */
        }
        /*      */
    }

    /*      */
    /*      */   public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        /* 1287 */     GenericSeekableLittleEndianAccessor genericSeekableLittleEndianAccessor = new GenericSeekableLittleEndianAccessor((SeekableInputStreamBytestream)new ByteArrayByteStream((byte[])msg));
        /* 1288 */     if (genericSeekableLittleEndianAccessor.available() < 2L)
            /*      */       return;
        /* 1291 */     MapleClient client = (MapleClient)ctx.channel().attr(MapleClient.CLIENT_KEY).get();
        /* 1292 */     if (client == null || !client.isReceiving())
            /*      */       return;
        /* 1295 */     short packetId = genericSeekableLittleEndianAccessor.readShort();
        /* 1296 */     int nType = packetId;
        log.info("当前处理封包ID："+packetId);
        /* 1297 */     if (packetId >= RecvPacketOpcode.BEGIN_USER.getValue())
            /* 1303 */       if (client.mEncryptedOpcode.containsKey(Integer.valueOf(nType)))
                /* 1304 */         packetId = (short)((Integer)client.mEncryptedOpcode.get(Integer.valueOf(nType))).intValue();
        /* 1312 */     for (RecvPacketOpcode recv : RecvPacketOpcode.values()) {
            /* 1313 */       if (recv.getValue() == packetId) {
                /* 1314 */         if (recv.NeedsChecking() && !client.isLoggedIn())
                    /*      */           break;
                /*      */         try {
                    /* 1318 */           if (client.getPlayer() != null && client.isMonitored() && ServerConfig.DEBUG_MODE)
                        /* 1319 */             try (FileWriter fw = new FileWriter(new File("日志/MonitorLogs/" + client.getPlayer().getName() + "_log.txt"), true)) {
                            /* 1320 */               fw.write(String.valueOf(recv) + " (" + Integer.toHexString(packetId) + ") Handled: \r\n" + genericSeekableLittleEndianAccessor.toString() + "\r\n");
                            /* 1321 */               fw.flush();
                            /*      */             }
                    /* 1325 */           handlePacket(recv, (SeekableLittleEndianAccessor)genericSeekableLittleEndianAccessor, client, this.type);
                    /* 1326 */         } catch (Exception e) {
                    /* 1327 */           log.error("封包: " + lookupRecv(packetId) + "\r\n" + genericSeekableLittleEndianAccessor.toString(true), e);
                    /*      */         }
                /*      */         return;
                /*      */       }
            /*      */     }
        /*      */   }

    /*      */
    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
        /* 1336 */
        MapleClient client = (MapleClient) ctx.channel().attr(MapleClient.CLIENT_KEY).get();
        /* 1337 */
        if (client != null && this.type == ServerType.频道服务器)
            /* 1338 */ client.sendPing(true);
        /*      */
    }

    /*      */
    /*      */
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
        /* 1344 */
        if (!(cause instanceof java.io.IOException)) {
            /* 1345 */
            MapleClient client = (MapleClient) ctx.channel().attr(MapleClient.CLIENT_KEY).get();
            /* 1346 */
            if (client != null && client.getPlayer() != null) {
                /* 1348 */
                client.getPlayer().saveToDB(false, false);
                /* 1349 */
                log.error("Exception caught by: " + client.getPlayer().getName(), cause);
                /*      */
            }
            /*      */
        }
        /*      */
    }

    /*      */
    /*      */
    private String lookupRecv(short header) {
        /* 1355 */
        for (RecvPacketOpcode recv : RecvPacketOpcode.values()) {
            /* 1356 */
            if (recv.getValue() == header)
                /* 1357 */ return recv.name();
            /*      */
        }
        /* 1360 */
        return "UNKNOWN";
        /*      */
    }
    /*      */
}
